//
//  MySquareButton.cpp
//  CanYouDoIt
//
//  Created by hoangtx on 7/15/13.
//
//

#include "MySquareButton.h"

bool MySquareButton::init(){
    MySpriteButton::init();
    return true;
}

MySquareButton* MySquareButton::create(const char *fileName, double mX, double mY, double mWidth, double mHeight){
    MySquareButton* button = MySquareButton::create();
    button->setPosition(ccp(mX,mY));
    button->buttonSize = CCSizeMake(mWidth, mHeight);
    button->sprite = CCSprite::create(fileName);
    button->sprite->setAnchorPoint(ccp(0,0));
    button->sprite->setScaleX(mWidth/button->sprite->getContentSize().width);
    button->sprite->setScaleY(mHeight/button->sprite->getContentSize().height);
    button->sprite->setPosition(ccp(0,0));
    button->sprite->setColor(button->normalColor);
    button->addChild(button->sprite);
    return button;
}

bool MySquareButton::isTouchedAt(cocos2d::CCPoint touchPosition){
    return getBoundingRect().containsPoint(touchPosition);
}